﻿<catel:DataWindow x:Class="Caitlyn.Views.SelectProjectItemView"
                  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
				  xmlns:catel="http://catel.codeplex.com" 
                  xmlns:converters="clr-namespace:Caitlyn.Converters">

    <catel:DataWindow.Resources>
        <converters:ProjectItemTypeToImageSourceConverter x:Key="ProjectItemTypeToImageSourceConverter" />
    </catel:DataWindow.Resources>
    
    <catel:StackGrid>
        <catel:StackGrid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="400" />
            <RowDefinition Height="Auto" />
        </catel:StackGrid.RowDefinitions>

        <catel:StackGrid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="600" />
        </catel:StackGrid.ColumnDefinitions>

        <Label catel:StackGrid.ColumnSpan="2">
            <TextBlock TextWrapping="Wrap">
                Please select the item to retrieve the name of.
            </TextBlock>
        </Label>

        <TreeView catel:StackGrid.ColumnSpan="2" ItemsSource="{Binding RootProjectItems}" SelectedValuePath="FullName" SelectedItemChanged="OnTreeViewSelectedItemChanged">
            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate ItemsSource="{Binding ProjectItems}">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="{Binding Type, Converter={StaticResource ProjectItemTypeToImageSourceConverter}}" Stretch="None" />
                        <TextBlock Text="{Binding Name}" ToolTip="{Binding FullName}" />
                    </StackPanel>
                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
        </TreeView>
        
        <Label Content="Selected item:" />
        <Label Content="{Binding SelectedProjectItemPath}" />
        
    </catel:StackGrid>
</catel:DataWindow>
